<template>
  <span :class="{'color-darkblue':id,'pointer':id}" @click="toDetail">
    <slot></slot>
  </span>
</template>

<script>
  export default {
    name: 'customer',
    props: {
      id: {
        type: [Number, String],
        default: () => undefined
      },
      type: {
        type: String,
        default: '1'
      }
    },
    methods: {
      toDetail() {
        if (!this.id) return
        this.$router.push({
          name: 'customer-detail',
          params: {
            id: this.id,
            type: this.type
          }
        })
      }
    }
  }
</script>
